<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2023/5/19
 * Time: 9:06
 */

namespace app\index\controller;


use think\Controller;
use app\index\model\Goods;
use app\index\model\GoodsPhone;
// 指定允许其他域名访问
header('Access-Control-Allow-Origin:*');
// 响应类型
header('Access-Control-Allow-Methods:POST');
// 响应头设置
header('Access-Control-Allow-Headers:x-requested-with,content-type');
class Open extends Controller
{
    public function index(){
        $query=input();
        $query['rows'] = isset($query['rows'])?$query['rows']:10;
        $query['page'] = isset($query['page'])?$query['page']:1;
        $yingqi =(new GoodsPhone)->group('course_id')->column('course_id');
        $goodsM = new Goods();
        $goods=$goodsM->where('id','in',$yingqi)->field('id,title,desc,pic1,name,teacher,status,date')->with('time')->limit($query['rows'])->page($query['page'])->order('id desc')->select();
        apiReturn(200,'成功',['list'=>$goods]);
    }

}